<template>
    <div class="mui-numbox" data-numbox-min='1' :data-numbox-max='9'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" value="1" @change="changedCount()" ref="numberBox">
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>
<script>
//因为有js效果，要导入js包并初始化
import mui from "../../../lib/mui/js/mui.min.js";
export default{
    mounted(){
        mui(".mui-numbox").numbox();
    },
    watch:{
        "max":function(nval,oval){
            mui(".mui-numbox").numbox().setOption("max",nval);
        },
    },
    props:["max"],
    methods:{
        changedCount(){
            this.$emit("func",parseInt(this.$refs.numberBox.value));
        }
    }
}
</script>
<style lang="less" scoped>
</style>